const postcss = require('postcss');
var tailwindcss = require('tailwindcss');
const inputCss = '@tailwind base;\n@tailwind components;\n@tailwind utilities;';
async function compilerTailwindcss(content) {
  const { css } = await postcss([
    tailwindcss({
      content: [
        {
          raw: content, // 将HTML内容作为字符串传递
          extension: 'html',
        },
      ],
      theme: {
        extend: {},
      },
      corePlugins: {
        preflight: false, // 禁用 Tailwind 的默认样式重置
      },
      plugins: [],
    }),
  ]).process(inputCss, {
    from: undefined, // 不指定输入文件
    to: undefined, // 不指定输出文件
  });
  return css;
}

module.exports = { compilerTailwindcss };
